<template>
  <div class="camerapage-comp-ct">
    <mt-header title="camerapage" fixed>
        <mt-button icon="back" @click="$router.back(-1)" slot="left">返回</mt-button>
    </mt-header>camerapage组件
    <mt-button type="primary" size="large" @click="scanner">扫一扫</mt-button>
  </div>
</template>
<script>
import scannerUtil from "@/cordova_plugins/BarcodeScanner.js";
import { Toast } from "mint-ui";
export default {
  name: "camerapage",
  methods: {
    scanner(){
      if (this.GLOBAL.plusReady){
        scannerUtil.scannerStart(
          ret => {
            alert(
              "We got a barcode\n" +
                "Result: " +
                ret.text +
                "\n" +
                "Format: " +
                ret.format +
                "\n" +
                "Cancelled: " +
                ret.cancelled
            );
          },
          err => {
            Toast("scanner erro!");
          }
        );
      }
      else Toast("dev has not ready");
    }
  }
};
</script>
<style lang="scss" scoped>
.camerapage-comp-ct {
}
</style>
